define_extension :revision, :current_local_snapshot do
  set(:real_revision) do
    area = Wondecap::Deployment::Area.find_by_name("local")
    raise "no current snapshot" unless area && area.current_snapshot
    dep = area.current_snapshot.find_deployment_by_name(project_name)
    raise "no deployment for #{project_name} found" unless dep
    dep.revision
  end
end

define_extension :revision, :current_local_snapshot_with_fallback do
  set(:real_revision) do
    area = Wondercap::Deployment::Area.find_by_name("local")
    next fetch_previous unless area && area.current_snapshot
    dep = area.current_snapshot.find_deployment_by_name(project_name)
    next fetch_previous unless dep
    dep.revision
  end
end
